<?php $this->load->view("admin/$adminCurrentTemplate/commonHead2");
if($this->input->server('REQUEST_METHOD')=='GET' || isset($error)){	
?>
<?php echo form_open_multipart('admin/upload');?>
<table width="99%" border="0" cellspacing="1" cellpadding="0" class="editFormContainer">
	<tr>
		<td class="guid">选择文件：</td>
		<td><input type="file" name="file" id="file" class="upload-file" /></td>
	</tr>
</table>
<input type="hidden" name="type" id="type" value="<?php if(isset($type)) echo $type?>" />
<input type="hidden" name="returnInput" id="returnInput" value="<?php if(isset($returnInput)) echo $returnInput?>" />
</form><?php
}
$this->load->view("admin/$adminCurrentTemplate/commonFoot2");?>
<script type="text/javascript">
$(function(){<?php 
	if(isset($upfile)){?>
	$('#<?php echo $returnInput?>',dg.iDoc('editMess')).val('<?php echo $upload_path.$upfile['file_name']?>');
	dg.cancel();
	<?php }else{?>dg.addBtn('subBtn','上 传',subForm);
	<?php }
	if(isset($error)){
		echo "var errorString = '$error';
		if(errorString.indexOf('to upload is larger')>0){
			errorMess(240,108,'上传错误','<span class=\"red\">对不起，上传文件超出允许大小！</span>');
		}else if(errorString.indexOf('attempting to upload is not allowed')>0){
			errorMess(230,108,'上传错误','<span class=\"red\">对不起，文件类型不允许上传！</span>');
		}";
	}?>
})

var errorMess = function(dialogWidth,dialogHeight,dialogTitle,dialogContent){
	var errorMessDialog = new dg.curWin.$.dialog({
		id:'errorMessDialog',
		width:dialogWidth,
		height:dialogHeight,
		parent:dg,
		cover: true,
		iconTitle:false,
		xButton:false,
		resize:false,
		rang:true,
		maxBtn:false,
		autoPos:{left:'center',top:'center'},
		cancelBtnTxt:'确 定',
		onCancel:function(){
			
		},
		title:dialogTitle,
		html:'<p class="mess-detail">' + dialogContent + '</p>'
	});
	errorMessDialog.ShowDialog();
}

var subForm = function(){
	if($('#file').val().length==0){
		subMess(210,108,'上传错误','<span class="red">对不起，请选择上传文件！</span>',$("#file"));
		return false;
	}	
	$('form').submit();
}
</script>